package com.m4f.fse.service.helper.impl;

import java.util.ArrayList;
import java.util.List;
import com.m4f.fse.service.ObjetifyEngineService;
import com.m4f.fse.service.helper.ifc.IServiceLocator;

public class StaticServiceLocator implements IServiceLocator {
	
	private static StaticServiceLocator INSTANCE = null;
	private ObjetifyEngineService engineService = null;
	
	private StaticServiceLocator() {
		
	}
	
	public static StaticServiceLocator getInstance() {
		if(INSTANCE == null) {
			INSTANCE = new StaticServiceLocator();
		}
		return INSTANCE;
	}
	
	public ObjetifyEngineService getEngineService()  {
		if(this.engineService == null) {
			List<String> model = new ArrayList<String>();
			model.add("com.m4f.fse.components.impl.BaseSearchEngine");
			model.add("com.m4f.fse.components.impl.GsaSearchEngine");
			try {
				this.engineService = new ObjetifyEngineService(model);
			} catch(Exception e) {
				e.printStackTrace();
			}
		}
		return this.engineService;
	}
	
}